subroutine lc5cb_init( )
use prec
use cell
use general
implicit none
   !----------------------------------------------------------------------------
   integer  :: i, moltype
   !----------------------------------------------------------------------------
   subnamep = subname
   subname  = 'lc5cb_init'
   !
   if ( allocated( bondsMol  ) ) deallocate( bondsMol  )
   if ( allocated( anglsMol  ) ) deallocate( anglsMol  )
   if ( allocated( dihrsMol  ) ) deallocate( dihrsMol  )
   if ( allocated( attypMol  ) ) deallocate( attypMol  )
   if ( allocated( atposMol  ) ) deallocate( atposMol  )
   if ( allocated( molIDMol  ) ) deallocate( molIDMol  )
   if ( allocated( rotatedMol) ) deallocate( rotatedMol)
   if ( allocated( chargeMol ) ) deallocate( chargeMol )
   if ( allocated( EMass     ) ) deallocate( EMass     )
   if ( allocated( sigma     ) ) deallocate( sigma     )
   if ( allocated( epison    ) ) deallocate( epison    )
   if ( allocated( bondcoef  ) ) deallocate( bondcoef  )
   if ( allocated( anglcoef  ) ) deallocate( anglcoef  )
   if ( allocated( torscoef  ) ) deallocate( torscoef  )
   if ( allocated( DistMin   ) ) deallocate( DistMin   )
   if ( allocated( EName     ) ) deallocate( EName     )
   !
   ntypeMol   = 8  ! 1: Ct; 2: CA; 3: Cp; 4: CN; 
                   ! 5: Cz; 6: HT; 7: HA; 8: Nz
   nbndtypMol = 7  ! 1: CT-HT; 2: CT-CT; 3: Ca-CT; 4: CA-HA
                   ! 5: Cp-Cp; 6: Cn-Cz; 7:Cz-Nz
   nangtypMol = 10 ! 1: HC-CT-HT; 2: CT-CT-HT; 3: CT-CT-CT;
                   ! 4: Ca-CT-HT; 5: Ca-CT-CT; 6: CA-CA-HA;
                   ! 7: CA-Cp-Cp; 8: CA-Cn-Cz; 9: Cn-Cz-Nz;
                   ! 10: CA-CA-CT
   ndihtypMol = 2  ! 2: CT-CT-CT-CT; 1: CA-Cp-Cp-CA
   !
   allocate( EMass(ntypeMol), sigma(ntypeMol), epison(ntypeMol),           &
   &         bondcoef(2, nbndtypMol), anglcoef(2, nangtypMol),             &
   &         torscoef(5, ndihtypMol), DistMin(ntypeMol), EName(ntypeMol+1) )
   EMass(1:5) = 12.0107D0
   EMass(6:7) = 1.00794D0
   EMass(8)   = 14.0067D0
   sigma      = 0.D0
   epison     = 0.D0
   DistMin  = (/ 1.8D0, 1.8D0, 1.8D0, 1.8D0, 1.8D0, 1.1D0, 1.1D0, 1.5D0 /)
   EName    = (/ 'C ', 'C ', 'C ', 'C ', 'C ', 'H ', 'H ', 'N ', 'Cu' /)
   !
   bondcoef = reshape( (/ 370.85D0, 1.088D0,& ! 1 CT-HC
   &                      289.59D0, 1.511D0,& ! 2 CT-CT
   &                      282.00D0, 1.498D0,& ! 3 CA-CT
   &                      392.0D0,  1.080D0,& ! 4 Ca-Ha
   &                      314.60D0, 1.465D0,& ! 5 Cp-Cp
   &                      373.00D0, 1.410D0,& ! 6 Cn-Cz
   &                   1357.00D0, 1.171D0/),& ! 7 Cz-Nz
   &                     (/2, nbndtypMol/) )
   anglcoef = reshape( (/ 33.D0,  107.8D0,  & ! 1 HC-CT-HC
   &                      44.27D0,111.86D0, & ! 2 CT-CT-HC
   &                      92.64D0,113.64D0, & ! 3 CT-CT-CT
   &                      35.D0,  109.5D0,  & ! 4 Cn-CT-HC
   &                      63.0D0, 114.0D0,  & ! 5 Cn-CT-Ct
   &                     37.255D0,120.0D0,  & ! 6 Ca-Ca-Ha
   &                    68.4154D0,120.0D0,  & ! 7 Ca-Cp-Cp
   &                    50.8619D0,120.0D0,  & ! 8 Ca-Cn-Cz
   &                    26.9057D0,180.0D0,  & ! 9 Cn-Cz-Nz
   &                    70.D0, 120.D0 /),   & ! 10 CA-CA-CT
   &                      (/2, nangtypMol/) )
   torscoef = reshape( (/ 2.9134D0, -0.0076D0,-10.2921D0, -0.0100D0, 9.3287D0,  & ! 1 CA-CP-CP-CA
                          2.0738D0, -4.3394D0, -0.5175D0,  7.2014D0, 1.3124D0/) & ! 2 CT-CT-CT-CT
   &                      , (/5, ndihtypMol/) )
   !=========================================================================
   ! 5 CB: CH3CH2CH2CH2CH2-<=>-<=>-CN
   !       1  2  3  4  5    6   7  8
   !=========================================================================
   molform    = 'CH3CH2CH2CH2CH2-<=>-<=>-CN'
   molname    = 'LC5CB'
   den0       = 1.08D0
   natomMol   = 38
   nbondsMol  = 27
   nanglsMol  = 55
   ndihrsMol  = 7
   !
   allocate( bondsMol(3, nbondsMol), AnglsMol(4, nanglsMol),                &
   &         dihrsMol(5, ndihrsMol), attypMol(natomMol),                    &
   &         atposMol(3,natomMol), chargeMol(natomMol), molIDMol(natomMol) )                
   !
   attypMol = (/ 1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 3,&
   &             2, 2, 3, 2, 2, 4, 2, 2, 7, 7, 7, 7, 7, 7, 7, 7, 5, 8 /)
   atposMol(:, 1) = (/ 26.7499D0, 15.3543D0, 25.2162D0 /)
   atposMol(:, 2) = (/ 25.4995D0, 15.7621D0, 26.0157D0 /)
   atposMol(:, 3) = (/ 24.4671D0, 14.6790D0, 26.1055D0 /)
   atposMol(:, 4) = (/ 23.0409D0, 15.0959D0, 26.4965D0 /)
   atposMol(:, 5) = (/ 23.0942D0, 15.7920D0, 27.8351D0 /)
   atposMol(:, 6) = (/ 27.5962D0, 16.0323D0, 25.1174D0 /)
   atposMol(:, 7) = (/ 27.4950D0, 16.1464D0, 25.1318D0 /)
   atposMol(:, 8) = (/ 26.4444D0, 14.9597D0, 24.2504D0 /)
   atposMol(:, 9) = (/ 25.0657D0, 16.6823D0, 25.6260D0 /)
   atposMol(:,10) = (/ 25.9425D0, 16.0128D0, 26.9771D0 /)
   atposMol(:,11) = (/ 24.3225D0, 14.2127D0, 25.1333D0 /)
   atposMol(:,12) = (/ 24.8809D0, 13.8626D0, 26.6951D0 /)
   atposMol(:,13) = (/ 22.4202D0, 14.2137D0, 26.6293D0 /)
   atposMol(:,14) = (/ 22.4434D0, 15.6919D0, 25.8147D0 /)
   atposMol(:,15) = (/ 23.7760D0, 16.5997D0, 28.0957D0 /)
   atposMol(:,16) = (/ 22.0963D0, 16.0131D0, 28.2083D0 /)
   atposMol(:,17) = (/ 23.5204D0, 14.7705D0, 28.8903D0 /)
   atposMol(:,18) = (/ 22.5298D0, 14.1815D0, 29.6493D0 /)
   atposMol(:,19) = (/ 22.8318D0, 13.6528D0, 30.8877D0 /)
   atposMol(:,20) = (/ 24.1243D0, 13.7130D0, 31.3671D0 /)
   atposMol(:,21) = (/ 25.1149D0, 14.3020D0, 30.6081D0 /)
   atposMol(:,22) = (/ 24.8129D0, 14.8307D0, 29.3697D0 /)
   atposMol(:,23) = (/ 24.3521D0, 13.3323D0, 32.7662D0 /)
   atposMol(:,24) = (/ 23.7253D0, 12.2104D0, 33.2687D0 /)
   atposMol(:,25) = (/ 23.8624D0, 11.8822D0, 34.6020D0 /)
   atposMol(:,26) = (/ 24.6264D0, 12.6760D0, 35.4330D0 /)
   atposMol(:,27) = (/ 25.2532D0, 13.7979D0, 34.9304D0 /)
   atposMol(:,28) = (/ 25.1161D0, 14.1261D0, 33.5971D0 /)
   atposMol(:,29) = (/ 21.6785D0, 13.7080D0, 29.1827D0 /)
   atposMol(:,30) = (/ 22.1882D0, 12.8634D0, 31.2523D0 /)
   atposMol(:,31) = (/ 26.1474D0, 14.1841D0, 30.9106D0 /)
   atposMol(:,32) = (/ 25.5765D0, 15.1641D0, 28.6834D0 /)
   atposMol(:,33) = (/ 22.9795D0, 11.6101D0, 32.7593D0 /)
   atposMol(:,34) = (/ 23.4624D0, 10.9851D0, 35.0537D0 /)
   atposMol(:,35) = (/ 25.5911D0, 14.4660D0, 35.7098D0 /)
   atposMol(:,36) = (/ 25.9603D0, 14.6600D0, 33.1857D0 /)
   atposMol(:,37) = (/ 24.9543D0, 12.4340D0, 36.7818D0 /)
   atposMol(:,38) = (/ 25.0357D0, 12.1137D0, 37.9050D0 /)
   !
   chargeMol = (/ -0.18D0, -0.12D0, -0.12D0, -0.12D0, -0.12D0,     &
   &               0.06D0, 0.060D0,  0.060D0, 0.06D0, 0.060D0,     &
   &               0.06D0, 0.060D0,  0.060D0, 0.06D0, 0.060D0,     &
   &               0.06D0, 0.000D0,  -0.122D0, -0.122D0, 0.D0,     &
   &              -0.122D0,-0.122D0, 0.D0, -0.122D0,-0.122D0,      &
   &               0.035D0, -0.122D0,-0.122D0, 0.122D0, 0.122D0,   &
   &               0.122D0, 0.122D0, 0.122D0, 0.122D0, 0.122D0,    &
   &               0.122D0, 0.395D0, -0.43D0 /)
  !                    Type, atom 1, atom 2
   bondsMol(:, 1) = (/   2,  2,  1 /)
   bondsMol(:, 2) = (/   2,  3,  2 /)
   bondsMol(:, 3) = (/   2,  4,  3 /)
   bondsMol(:, 4) = (/   2,  5,  4 /)
   bondsMol(:, 5) = (/   1,  6,  1 /)
   bondsMol(:, 6) = (/   1,  7,  1 /)
   bondsMol(:, 7) = (/   1,  8,  1 /)
   bondsMol(:, 8) = (/   1,  9,  2 /)
   bondsMol(:, 9) = (/   1, 10,  2 /)
   bondsMol(:,10) = (/   1, 11,  3 /)
   bondsMol(:,11) = (/   1, 12,  3 /)
   bondsMol(:,12) = (/   1, 13,  4 /)
   bondsMol(:,13) = (/   1, 14,  4 /)
   bondsMol(:,14) = (/   1, 15,  5 /)
   bondsMol(:,15) = (/   1, 16,  5 /)
   bondsMol(:,16) = (/   3, 17,  5 /)
   bondsMol(:,17) = (/   5, 23, 20 /)
   bondsMol(:,18) = (/   4, 29, 18 /)
   bondsMol(:,19) = (/   4, 30, 19 /)
   bondsMol(:,20) = (/   4, 31, 21 /)
   bondsMol(:,21) = (/   4, 32, 22 /)
   bondsMol(:,22) = (/   4, 33, 24 /)
   bondsMol(:,23) = (/   4, 34, 25 /)
   bondsMol(:,24) = (/   4, 35, 27 /)
   bondsMol(:,25) = (/   4, 36, 28 /)
   bondsMol(:,26) = (/   6, 37, 26 /)
   bondsMol(:,27) = (/   7, 38, 37 /)
   !                   Type,  atom1,  atom2, atom3
   AnglsMol(:, 1) = (/  2,  2,  1,  6 /)
   AnglsMol(:, 2) = (/  2,  2,  1,  7 /)
   AnglsMol(:, 3) = (/  2,  2,  1,  8 /)
   AnglsMol(:, 4) = (/  1,  6,  1,  7 /)
   AnglsMol(:, 5) = (/  1,  6,  1,  8 /)
   AnglsMol(:, 6) = (/  1,  7,  1,  8 /)
   AnglsMol(:, 7) = (/  3,  1,  2,  3 /)
   AnglsMol(:, 8) = (/  2,  1,  2,  9 /)
   AnglsMol(:, 9) = (/  2,  1,  2, 10 /)
   AnglsMol(:,10) = (/  2,  3,  2,  9 /)
   AnglsMol(:,11) = (/  2,  3,  2, 10 /)
   AnglsMol(:,12) = (/  1,  9,  2, 10 /)
   AnglsMol(:,13) = (/  3,  2,  3,  4 /)
   AnglsMol(:,14) = (/  2,  2,  3, 11 /)
   AnglsMol(:,15) = (/  2,  2,  3, 12 /)
   AnglsMol(:,16) = (/  2,  4,  3, 11 /)
   AnglsMol(:,17) = (/  2,  4,  3, 12 /)
   AnglsMol(:,18) = (/  1, 11,  3, 12 /)
   AnglsMol(:,19) = (/  3,  3,  4,  5 /)
   AnglsMol(:,20) = (/  2,  3,  4, 13 /)
   AnglsMol(:,21) = (/  2,  3,  4, 14 /)
   AnglsMol(:,22) = (/  2,  5,  4, 13 /)
   AnglsMol(:,23) = (/  2,  5,  4, 14 /)
   AnglsMol(:,24) = (/  1, 13,  4, 14 /)
   AnglsMol(:,25) = (/  2,  4,  5, 15 /)
   AnglsMol(:,26) = (/  2,  4,  5, 16 /)
   AnglsMol(:,27) = (/  5,  4,  5, 17 /)
   AnglsMol(:,28) = (/  1, 15,  5, 16 /)
   AnglsMol(:,29) = (/  4, 15,  5, 17 /)
   AnglsMol(:,30) = (/  4, 16,  5, 17 /)
   AnglsMol(:,31) = (/ 10,  5, 17, 18 /)
   AnglsMol(:,32) = (/ 10,  5, 17, 22 /)
   AnglsMol(:,33) = (/  6, 17, 18, 29 /)
   AnglsMol(:,34) = (/  6, 19, 18, 29 /)
   AnglsMol(:,35) = (/  6, 18, 19, 30 /)
   AnglsMol(:,36) = (/  6, 20, 19, 30 /)
   AnglsMol(:,37) = (/  7, 19, 20, 23 /)
   AnglsMol(:,38) = (/  7, 21, 20, 23 /)
   AnglsMol(:,39) = (/  6, 20, 21, 31 /)
   AnglsMol(:,40) = (/  6, 22, 21, 31 /)
   AnglsMol(:,41) = (/  6, 17, 22, 32 /)
   AnglsMol(:,42) = (/  6, 21, 22, 32 /)
   AnglsMol(:,43) = (/  7, 20, 23, 24 /)
   AnglsMol(:,44) = (/  7, 20, 23, 28 /)
   AnglsMol(:,45) = (/  6, 23, 24, 33 /)
   AnglsMol(:,46) = (/  6, 25, 24, 33 /)
   AnglsMol(:,47) = (/  6, 24, 25, 34 /)
   AnglsMol(:,48) = (/  6, 26, 25, 34 /)
   AnglsMol(:,49) = (/  8, 25, 26, 37 /)
   AnglsMol(:,50) = (/  8, 27, 26, 37 /)
   AnglsMol(:,51) = (/  6, 26, 27, 35 /)
   AnglsMol(:,52) = (/  6, 28, 27, 35 /)
   AnglsMol(:,53) = (/  6, 23, 28, 36 /)
   AnglsMol(:,54) = (/  6, 27, 28, 36 /)
   AnglsMol(:,55) = (/  9, 26, 37, 38 /)
   !         Type, atom1, atom2, atom3, atom4
   DihrsMol(:, 1) = (/  2,  4,  3,  2,  1 /)
   DihrsMol(:, 2) = (/  2,  5,  4,  3,  2 /)
   DihrsMol(:, 3) = (/  2, 17,  5,  4,  3 /)
   DihrsMol(:, 4) = (/  1, 24, 23, 20, 19 /)
   DihrsMol(:, 5) = (/  1, 24, 23, 20, 21 /)
   DihrsMol(:, 6) = (/  1, 28, 23, 20, 19 /)
   DihrsMol(:, 7) = (/  1, 28, 23, 20, 21 /)
   !
   molIDMol  = (/ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, &
   &              2, 2, 2, 2, 2, 2, 3, 3, 3, 3, &
   &              3, 3, 4, 4, 4, 4, 4, 4, 2, 2, &
   &              2, 2, 2, 2, 2, 2, 2, 2 /)
   nMol      = maxval(molIDMol)
   molmass   = 0.D0
   do i = 1, natomMol
      molmass = molmass + EMass( attypMol(i) )
   enddo
   forall ( i=1:3 ) minbox(i) = maxval(atposMol(i,:)) - minval(atposMol(i,:))
   minlen = maxval( minbox )
   allocate( rotatedMol( 3, natomMol) )
   !
   subname = subnamep
return
end subroutine
